<?
print_r($ordini);
?>
<script type="text/javascript" charset="utf-8">
 $(function(){
 	$("a.dettaglio").click(function(){
 		
 		var id_ordine = $(this).attr('rev');
 		if($("#ordine_"+id_ordine).html()=="")
 		{
	 		$("#ordine_"+id_ordine).html("<center><small>Loading...</small></center>");
	 		$.getJSON("/aj_select.php?req=getord&id_negozio=<?echo $this->negozio->id;?>&",{id_ordine: id_ordine}, function(j){
	 			var riepilogo = '';
	 			for (var i = 0; i < j.length; i++) {
	 				riepilogo += j[i].riepilogoOrdine ;
	 			}
	 			$("#ordine_"+id_ordine).html(riepilogo);
	 			
	 		})
 		}else
 		{
 			$("#ordine_"+id_ordine).html("");
 		}
 	})
 })
</script>
<div id="content"> 
    <h1 class="pagetitle">Gestione ordini</h1>
    <a href="/admin/" id="rss-posts">Indietro</a> 
    <div class="post">
    	
      <h2 class="title"><? echo "Ultimi ordini";?></h2>
      <p class="byline">
      	<small>
      		<p></p>
      		
      </small>
      </p>
    
      
     <table class="tabellaList" cellpadding="0" cellspacing="0">
     <tr >
      	  
      	  <td class="rigaList" width="100px"></td>
      	  <td class="rigaList" width="40px"></td>
	      <td class="rigaList" width="140px""></td>
	      <td class="rigaList" width="140px"></td>
	      <td class="rigaList" width="50px"></td>
	      <td class="rigaList" width="85px"></td>
	      <td class="rigaList" ></td> 
      </tr>
 <?
	if(count($ordini->lista[id])>0)
	{
		foreach($ordini->lista[id] as $ido=>$id_ord)
		{ 
 ?>     
      <tr >
      	  
      	  <td class="rigaList" align="left"><? echo date("j/n",$ordini->lista[data_ins][$ido]);?>   &nbsp;&nbsp;&nbsp;  <a class="dettaglio" rev="<? echo $ido;?>" href="javascript:return false;"><img border="0" src="/_admin/img/led<? if($ordini->lista[stato][$ido]==1)echo "yellow"; elseif($ordini->lista[stato][$ido]==2) echo "lightgreen"; elseif($ordini->lista[stato][$ido]==3) echo "green";  elseif($ordini->lista[stato][$ido]==4) echo "lightblue"; elseif($ordini->lista[stato][$ido]==5) echo "red";?>.png" /></a></td>
      	  <td class="rigaList" align="left"><a class="dettaglio" rev="<? echo $ido;?>" href="javascript:return false;"><? echo $ordini->lista[id][$ido];?></a></td>
	      <td class="rigaList" align="left"><a href="ordini.php?id_ordine=<? echo $ido;?>&mod=mod"><? echo $ordini->lista[pagam_nome][$ido];?> <? echo $ordini->lista[pagam_nome][$ido];?></a> </td>
	      <td class="rigaList" align="left"><? echo $ordini->lista[pagam_citta][$ido];?></td>
	      <td class="rigaList" align="right"><? echo $ordini->lista[colli][$ido];?>pz</td>
	      <td class="rigaList" align="right" nowrap>€ <? echo number_format($ordini->lista[totale][$ido],$_SESSION[configurazione][n_decimali],"."," ");?></td>
	      <td class="rigaList" align="right" nowrap><a href="ordini.php?id_ordine=<? echo $ido;?>&mod=mod"><img  src="/_admin/img/edit.png" border="0" /></a>
	         <a href="ordini.php?mod=del&id_ordine=<? echo $ido;?>"><img  src="/_admin/img/cancel.png" border="0" /></a>
	      </td> 
      </tr>
      <tr> 
      	<td colspan="7"><div class="dettaglio_ordine" id="ordine_<? echo $ido;?>"></div></td>
      <tr/>
<?
		}
	}
	else 
	{
?>
	  <tr>
	      <td colspan="5">
	        Nessun ordine trovato.
	      </td>
      </tr>
<?		
	}
?>
      </table> 
      
    </div>
    
    
    
    
   
  </div>